import request from '../../utils/request';

// 横幅管理相关 API

// 创建横幅
export const createBanner = (data: any) => {
    return request({
        url: '/system/api/banner',
        method: 'post',
        data
    });
};

// 更新横幅
export const updateBanner = (id: string, data: any) => {
    return request({
        url: `/system/api/banner/${id}`,
        method: 'put',
        data
    });
};

// 更新横幅状态
export const updateBannerStatus = (id: string, status: number) => {
    return request({
        url: `/system/api/banner/${id}/status/${status}`,
        method: 'put'
    });
};

// 分页查询横幅
export const getBannerPage = (params: any) => {
    return request({
        url: '/system/api/banner/page',
        method: 'get',
        params
    });
};

// 获取横幅列表
export const getBannerList = () => {
    return request({
        url: '/system/api/banner/list',
        method: 'get'
    });
};

// 根据语言获取启用的横幅
export const getEnabledBannerByLanguage = (language: string) => {
    return request({
        url: `/system/api/banner/enabled/${language}`,
        method: 'get'
    });
};

// 根据ID获取横幅
export const getBannerById = (id: string) => {
    return request({
        url: `/system/api/banner/${id}`,
        method: 'get'
    });
};

// 删除横幅
export const deleteBanner = (id: string) => {
    return request({
        url: `/system/api/banner/${id}`,
        method: 'delete'
    });
};

// 批量操作横幅
export const batchBanner = (data: any) => {
    return request({
        url: '/system/api/banner/batch',
        method: 'post',
        data
    });
};
